/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Jon
 */
public class MainClass
{
    public static void main(String[] args)
    {
        TestObject test1 = new TestObject(1, 2, 3);
        TestObject test2 = new TestObject(4, 5, 6);

        System.out.println("X: " + test1.getX() + " Y: " + test1.getY() + " Z: " + test1.getZ());
        System.out.println("X: " + test2.getX() + " Y: " + test2.getY() + " Z: " + test2.getZ());

        test1 = test2;
        ///Now they are the same! They point to the same object now.
        System.out.println("X: " + test1.getX() + " Y: " + test1.getY() + " Z: " + test1.getZ());
        System.out.println("X: " + test2.getX() + " Y: " + test2.getY() + " Z: " + test2.getZ());

        test(test1);
        ///Both objects change cause they are both pointing to the same one from above.
        System.out.println("X: " + test1.getX() + " Y: " + test1.getY() + " Z: " + test1.getZ());
        System.out.println("X: " + test2.getX() + " Y: " + test2.getY() + " Z: " + test2.getZ());
    }

    public static void test(TestObject obj)
    {
        obj.setX(10);
        obj.setY(15);
        obj.setZ(20);
    }
}